[D]DLS-702-feature(ui-react-visualization): Add Scrubber component#680
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds an interactive “Scrubber” feature to ui-react-visualization charts, enabling hover/touch/keyboard-driven selection of an x-position and rendering corresponding chart overlays (line/label/beacons).
Changes:
- Introduce
Scrubbercomponent + provider/context for pointer/touch/keyboard interactions. - Wire scrubbing support through
CartesianChartandLineChartpublic APIs. - Add unit tests and Storybook stories for scrubber behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/ui-react-visualization/src/lib/utils/scales/scales.ts | Adds a helper to map a single x value to pixel space (incl. band centering). |
| libs/ui-react-visualization/src/lib/Components/Scrubber/utils.ts | Adds pixel→data-index resolution for different x-scale modes. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/utils.test.ts | Tests for pixel→index mapping across band/linear + axis-data cases. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/types.ts | Defines scrubber props/context/provider types. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/ScrubberProvider.tsx | Attaches SVG event listeners and manages scrubber position state. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/ScrubberProvider.test.tsx | Integration-style tests for provider interactions (mouse/keys/focus). |
| libs/ui-react-visualization/src/lib/Components/Scrubber/Scrubber.tsx | Renders scrubber visuals (line, overlay, label, beacons). |
| libs/ui-react-visualization/src/lib/Components/Scrubber/Scrubber.test.tsx | Tests scrubber rendering toggles and basic positioning. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/Scrubber.stories.tsx | Storybook coverage for scrubber usage scenarios. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/index.ts | Public exports for scrubber module. |
| libs/ui-react-visualization/src/lib/Components/Scrubber/context/* | Safe context + hook for scrubber state. |
| libs/ui-react-visualization/src/lib/Components/LineChart/types.ts | Adds enableScrubbing + onScrubberPositionChange to LineChart API. |
| libs/ui-react-visualization/src/lib/Components/LineChart/LineChart.tsx | Passes scrubbing props through to CartesianChart. |
| libs/ui-react-visualization/src/lib/Components/LineChart/LineChart.stories.tsx | Adds a “real-time” scrubbing demo story. |
| libs/ui-react-visualization/src/lib/Components/index.ts | Re-exports scrubber from components barrel. |
| libs/ui-react-visualization/src/lib/Components/CartesianChart/types.ts | Adds scrubbing props to CartesianChart API. |
| libs/ui-react-visualization/src/lib/Components/CartesianChart/CartesianChart.tsx | Mounts ScrubberProvider, makes SVG focusable when enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ba93481 to
1564a21
Compare
…ent opacity; refactor Scrubber stories and tests
… XAxis and YAxis; enhance Scrubber component with context notification fix
… dashed configurations
…ts for scrubber position updates
ace7f23 to
e711320
Compare
aquelemiguel
left a comment
There was a problem hiding this comment.
Regarding the gradient on the scrubber, I know we've brought this up in a daily before, but now I've had time to collect my ideas... I think the reason it looks odd is in this situation where the line intersects the lightest part:
It looks way better here, where the intersect point is near the graph's equator so the gradient is in its most opaque part:
I'd suggest confirming with Laurine if any of these solutions could work:
- Remove gradient altogether, just use a solid line (we tried this before, mixed opinions).
- Make it so the gradient always starts at the point of intersection, not in the equator of the graph (could be difficult dev-wise).
- Remove both the gradient and the line (the change in transparency might be enough for the user to pinpoint the correct X coordinate).
Regardless, excellent work on this @zel-kass, as always. Nothing to point out code-wise, it's a bit cryptic and math heavy. Mostly tested interacting with it and feels great. 🫶
…isual consistency; utilize ref for scrubber position management
…t; introduce constants for improved readability
aammami-ledger
left a comment
There was a problem hiding this comment.
Beautiful work on this one 👏
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (2)
libs/ui-react-visualization/src/lib/Components/Axis/XAxis/XAxis.tsx:21
- This PR changes the default
gridLineStylefrom dashed to solid and updates the grid line stroke token. Since the PR description only mentions adding Scrubber, this axis default styling change looks out of scope; consider documenting it in the PR description or splitting it into a separate change to keep behavior changes isolated.
export function XAxis({
gridLineStyle = 'solid',
position = 'bottom',
showGrid = false,
showLine = false,
showTickMark = false,
libs/ui-react-visualization/src/lib/Components/Axis/YAxis/YAxis.tsx:21
- This PR changes the default
gridLineStylefrom dashed to solid and updates the grid line stroke token. Since the PR description only mentions adding Scrubber, this axis default styling change looks out of scope; consider documenting it in the PR description or splitting it into a separate change to keep behavior changes isolated.
export function YAxis({
gridLineStyle = 'solid',
position = 'start',
showGrid = false,
showLine = false,
showTickMark = false,
… guard for number arrays
…nfiguration for numeric data; update types for improved clarity
…for improved scrubbing logic
|



Overview
Introduce Scrubber component with keyboard controls, and plug it to CartesianChart.
